//
//  QiPanLayer.m
//  airplane
//
//  Created by gump gump on 5/22/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "QiPanLayer.h"
#import "cocos2d.h"
#import "ChessBoardMgr.h"
#import "Chess.h"
@implementation QiPanLayer


-(void)draw
{
    glPointSize(20);
	glColor4ub(0,255,0,128);
    
    
	
	// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
	// Needed states: GL_VERTEX_ARRAY, 
	// Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY	
	glDisable(GL_TEXTURE_2D);
	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);
	
//    for(Chess *chess in [ChessBoardMgr sharedManager].vertexWriteArr)
//    {
//        CGPoint point = chess.vertexPt;
//        ccVertex2F p = (ccVertex2F) {point.x * CC_CONTENT_SCALE_FACTOR(), point.y * CC_CONTENT_SCALE_FACTOR() };
//        glVertexPointer(2, GL_FLOAT, 0, &p);
//    }
    
    CGPoint point = ccp(200,20);
    ccVertex2F p ;//= (ccVertex2F   *)malloc(sizeof(ccVertex2F)); 
    p = (ccVertex2F) {point.x * CC_CONTENT_SCALE_FACTOR(), point.y * CC_CONTENT_SCALE_FACTOR() };
    glVertexPointer(2, GL_FLOAT, 0, &p);
    
    point = ccp(10,10);
    ccVertex2F p1;// = (ccVertex2F   *)malloc(sizeof(ccVertex2F)); 
    p1 = (ccVertex2F) {point.x * CC_CONTENT_SCALE_FACTOR(), point.y * CC_CONTENT_SCALE_FACTOR() };
    glVertexPointer(2, GL_FLOAT, 0,&p1);
    
	glDrawArrays(GL_POINTS, 0,2);//[ChessBoardMgr sharedManager].vertexWriteArr.count);
    
	// restore default state
	glEnableClientState(GL_COLOR_ARRAY);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	glEnable(GL_TEXTURE_2D);
    
}

-(void)initLayer
{
    [[ChessBoardMgr sharedManager] initArr];
}





@end
